package contract

import (
	"crypto/ecdsa"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/core/types"
	"github.com/ethereum/go-ethereum/ethclient"
	"go-chain-data/contract/evmAbi"
	"math/big"
)

// SandToken  封装了调用交易对transfer函数的逻辑
func SandToken(client *ethclient.Client, privateKey *ecdsa.PrivateKey, tokenAddress common.Address, toAddress common.Address, value *big.Int) (*types.Transaction, error) {
	tx, err := SendTransaction(client, privateKey, tokenAddress, evmAbi.ERC20_ABI, "transfer", toAddress, value)
	if err != nil {
		return nil, err
	}
	return tx, nil
}
